package com.算法.软件设计与开发.试题编号_2_1_14_初等人工智能系统关键算法;

import java.util.Arrays;
import java.util.Scanner;

public class 任务二_字符判断功能关键算法 {
    /**
     * 输入一行字符，输出其中的字母的个数。例如输入“Et2f5F218”，输出结果为 4。
     * 注意：综合使用分支、循环结构语句实现。
     * @param args
     */
    private static char[] dic={
        'a','A','b','B','c','C','d','D','e','E',
        'f','F','g','G','h','H','i','I','j','J',
        'k','K','l','L','m','M','n','N','o','O',
        'p','P','q','Q','r','R','s','S','t','T',
        'u','U','v','V','w','W','x','X','y','Y',
        'z','Z'
    };
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String str = sc.nextLine();

        int count = 0;
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            for (int j = 0; j <dic.length; j++) {
                if(dic[j] == c){
                    count++;
                    System.out.print(c+" ");
                }
            }
        }
        System.out.println("\n输出:"+count);
//        System.out.print("输出26字母(大小写)："+str());
    }

    public static String str(){
        String[] str = new String[26];
        String[] str1 = new String[26];
        for (int i = 0; i <26 ; i++) { //小写
            char c = (char) (96 + i + 1);
            str[i] = "\""+c+"\"";
            char c1 = Character.toUpperCase((char) (96 + i));//大写
            str1[i] = "\""+c1+"\"";
        }
        return Arrays.toString(str)+","+Arrays.toString(str1);
    }
}
